<template>
    <el-form label-width="40px" :model="DeviceCategory" ref="DeviceCategory_ref">
        <el-form-item label="名称" prop="DeviceCategoryName">
            <el-input v-model="DeviceCategory.DeviceCategoryName"></el-input>
        </el-form-item>
        <el-form-item label="上级"  prop="ParentId">
            <el-select v-model="DeviceCategory.ParentId" style="width: 100%">
                <el-option v-for="item in AllDeviceCategory" v-if="item.ParentId == 0" :value="item.Id" :label="item.DeviceCategoryName"></el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="编码"  prop="Code">
            <el-input  v-model="DeviceCategory.Code"></el-input>
        </el-form-item>
        <el-form-item label="备注"  prop="DeviceCategoryDescript">
            <el-input  v-model="DeviceCategory.DeviceCategoryDescript"></el-input>
        </el-form-item>
        <el-form-item align="center">
            <el-button type="warning" @click="UpdateSubmit">修改</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
    export default {
        name: "UpdataDeviceCategory",
        props: {
            AllDeviceCategory: {
                type: Array,
                required: true
            },
            DeviceCategory: {
                type: Object,
                required: true
            }
        },
        methods: {
            UpdateSubmit() {
                let loadding = this.openLoading();
                this.$http.post('Device/UpdateDeviceCategoryContent', this.DeviceCategory).then(res => {
                    loadding.close();
                    if (res) {
                        this.$message.success('修改成功!')
                        this.$parent.$parent.UpdataDeviceCategory_dialog = false
                        this.$parent.$parent.formdata()
                    } else {
                        this.$message.warning('修改失败,请重试!')
                    }
                })
            }
        }
    }
</script>

<style scoped>

</style>
